
import allure
from common.send_request import request_run_main
import json


def allure_report(url,header,data,result):
    response = request_run_main( url=url, data=data, header=header)
    with allure.step("请求参数"):
        allure.attach('请求url={}\n 请求头header={}\n 请求数据data={}'.format(url, header,data), '请求参数',attachment_type=allure.attachment_type.TEXT)
    with allure.step("响应数据"):
        allure.attach('{}'.format(response.text), '响应数据', attachment_type=allure.attachment_type.TEXT)

        # 断言是否成功
    with allure.step("断言"):
        allure.attach('响应中包含预计结果{}'.format(result), '断言数据',
                      attachment_type=allure.attachment_type.TEXT)
      #返回响应数据
    return response
